<template>
	<view :style="{padding:`${$safeh}px 0rpx `}">
		<view class="info u-p-30">
			<view class="info_left">
				<image src="../../static/logo.png" mode=""></image>
				<text class="u-m-l-20" >{{info.nick_name||'请完善'}}</text>
			</view>
			<text @click="$goTo('/pages/changeinfo/changeinfo')" >修改资料</text>
		</view>
		
		<view class="cellbox">
			<view class="cellboxitem u-m-t-100">
				<text>学情报告</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			
			<view class="cellboxitem u-m-t-10">
				<text>我的会员</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			
			<view class="cellboxitem u-m-t-10" @click="$goTo('/pages/feedback/feedback')">
				<text>使用建议与问题反馈</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			<view class="cellboxitem u-m-t-10" @click="logout">
				<text>退出登录</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
		</view>
		
		<parentstabbar :value='2' > </parentstabbar>
	</view>
	
</template>

<script>
	import parentstabbar from '../../components/parentstabbar.vue'
	
	export default {
		components:{
			parentstabbar
		},
		data() {
			return {
				info:{}
			};
		},
		onShow() {
			this.init()
		},
		methods:{
			init(){
				this.$api.get('/user/info',{}).then(res=>{
					this.info = res.data
				}).catch(err=>{
					this.$toast(err.message)
					setTimeout(()=>{
						uni.reLaunch({
							url:'/pages/login/login'
						})
					},1000)
				})
			},
			logout(){
				uni.removeStorageSync('token')
				uni.removeStorageSync('role')
				uni.removeStorageSync('tokenHead')
				this.$toast('退出成功~')
				setTimeout(()=>{
					uni.reLaunch({
						url:'/pages/login/login'
					})
				},1000)
			}
		}
	}
</script>

<style lang="scss" scoped>
.info{
	width: 100vw;
	box-sizing: border-box;
	background-color: #fff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	image{
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
	}
	.info_left{
		display: flex;
		align-items: center;
	}
}
.cellboxitem{
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100vw;
	padding: 50rpx 20rpx;
	box-sizing: border-box;
	background-color: #fff;
}
</style>
